Repository navigation
Fix documentation errors in Java.Util.Concurrent, Java.Util.Concurrent.Atomic, Java.Util.Concurrent.Locks and Java.Util.Functions (R080, pass 3) - #1959
Conversation
The timed wait times out only if the barrier is neither tripped nor broken. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for this documentation-only clarification of timed barrier waits.
No open issues 🎉
What changed in this PR
This documentation-only follow-up to #1769 clarifies the timeout behavior of CyclicBarrier.AwaitAsync(long, TimeUnit).
Changes:
- Specifies that the task faults with
TimeoutExceptionwhen the wait times out before the barrier is tripped or broken. - Leaves API signatures and runtime behavior unchanged.
| File | Description |
|---|---|
| docs/xml/Java.Util.Concurrent/CyclicBarrier.xml | Clarifies the timed AwaitAsync return documentation to account for a broken barrier. |
Review effort: Balanced
|
@dalexsoto review |
|
In response to @jonathanpeppers's request: The changed timeout sentence matches the inspected CyclicBarrier implementation, and the Task.Run wrapper is checked. I still need to read CyclicBarrier.xml lines 1-448 and 493 through the end, and establish immutable-source correspondence for the libcore body before the complete-file final pass. This is a reviewer coverage gap, not an identified defect in the PR. Those reads were not completed in this review window; there was no source-fetch failure. |
dalexsoto
left a comment
There was a problem hiding this comment.
Approving. The one-line change to AwaitAsync(long, TimeUnit) in CyclicBarrier.xml (L486) is correct.
- Matches AOSP behaviour. In libcore
CyclicBarrier.dowait, the broken check (L251) and the tripped/generation check (L254) both run before the timeout check (L257-259). ATimeoutExceptionis therefore only thrown when the barrier is neither tripped nor broken. If the barrier is already broken, or breaks during the wait (interrupt, another party's timeout,Reset),BrokenBarrierExceptionis thrown instead, so "before the barrier is tripped or broken" is the accurate wording. - The async wrapper inherits this. The generator's
MethodAsyncWrapper(dotnet/android@9bc18c75,external/Java.Interop/tools/generator/SourceWriters/MethodAsyncWrapper.csL33) wraps the synchronousAwait(timeout, unit)inTask.Run, so these Java exceptions fault the returned task. - The rest of the sentence still holds.
breakBarrier()runs right beforeTimeoutExceptionis thrown, so "the barrier enters the broken state" andIsBrokenreturningtrueare still accurate. - The rest of the file is consistent. I read the whole file:
Await(long, TimeUnit)(L396-427),Await(),IsBrokenandResetall agree.AwaitAsync()has no timeout wording, so it doesn't need the same fix, and no other member uses the old phrase. - No markup changes. The crefs (
T:Java.Util.Concurrent.TimeoutException,P:Java.Util.Concurrent.CyclicBarrier.IsBroken) resolve, and the file still parses as XML. - No base-branch conflict.
CyclicBarrier.xmlis unchanged onmainsince the PR's merge base.
I found no blocking issues. This was a static review; I didn't run any builds or tests.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
a2e93bb08ed00176982d808f929a639ecef5d2eegit diff --checkpasses.↑
CyclicBarrier.javadowaitchecksg.brokenbefore the timeout check.↑ The Gemini 4 Argon review found no issues.
↓ OpenPublishing.Build has not run yet.
BrokenBarrierException, notTimeoutException.↑ Pass-2 human reviewer follow-up requested this change.
↓ The old text was incomplete, not false for the timeout case.
Scope
Pass-3 review of item R080: 146 files in Java.Util.Concurrent, Java.Util.Concurrent.Atomic, Java.Util.Concurrent.Locks and Java.Util.Functions. I reviewed only the text that changed in
git diff 86f7744a1 origin/main, including the pass-2 edits from #1769.9d637c3af6654a2f1b696b3d19c54bb77e38df2b0106116934703f314b3d4e84. Async wrappers: dotnet/android@9bc18c7,external/Java.Interop/tools/generator/SourceWriters/MethodAsyncWrapper.csL33 andMethodExtensionAsyncWrapper.csL27 (Task.Run(() => ...)).Fixes
CyclicBarrier.AwaitAsync(long, TimeUnit)<returns>: "If the wait times out before the barrier is tripped," is now "If the wait times out before the barrier is tripped or broken,".java/util/concurrent/CyclicBarrier.javadowaitchecksg.brokenat L251 and throwsBrokenBarrierExceptionbefore the timeout check at L257. A wait therefore times out only when the barrier is neither tripped nor broken. This matches the syncAwait(long, TimeUnit)Javadoc. The pass-2 reviewer also asked for this change.Uncertain findings
None.
Out of scope (pass-2 follow-up notes)
LinkedBlockingQueue.Offer(Object, long, TimeUnit)remarks: this text is verbatim imported Javadoc, not AI-changed. Only the params were changed, and they are correct. For information:LinkedBlockingQueue.javaL356–378 returnsfalsewhennanos <= 0only while the queue is full.CountDownLatch.Await(long, TimeUnit)(sync): the AI did not change this text. Only theAwaitAsyncmembers were changed, and they are correct (CountDownLatch.javaawait(long, TimeUnit)returnsfalseif the waiting time elapses before the count reaches zero).Checks
core.autocrlf); only the 10 added characters changed.git diff --checkpassed. No new placeholders.assistant_usage_events(23gemini-4-argonrows for this session).